home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / graphics / imageengineerv1.1 / arexx / makeicon.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-04-11  |  1.6 KB  |  66 lines

  1. /* Image Engineer ARexx macro script           */
  2. /* by Simon Edwards                            */
  3. /* 4/4/95                                      */
  4. /* MakeIcon V1.0                               */
  5. /*                                             */
  6. /* Renders an icon of an image and saves it to */
  7. /* the clipboard for pasting into IconEdit.    */
  8.  
  9. Options results
  10. signal on error            /* Setup a place for errors to go */
  11.  
  12. if arg()==0 then exit
  13.  
  14. PROJECT_INFO arg(1) WIDTH
  15. ImageWidth=RESULT
  16. PROJECT_INFO arg(1) HEIGHT
  17. ImageHeight=RESULT
  18.  
  19. if ImageWidth/ImageHeight>2.0 then
  20.     do
  21.     NewWidth=80
  22.     NewHeight=ImageHeight*80.0/ImageWidth
  23.     end
  24. else
  25.     do
  26.     NewWidth=ImageWidth*40.0/ImageHeight
  27.     NewHeight=40
  28.     end
  29.  
  30. SCALE arg(1) NewWidth NewHeight BEST
  31. icon=RESULT
  32. 'LOAD_PALETTE' icon '"IE:palettes/wb.palette"'
  33. RENDER_DEPTH icon 4
  34. RENDER_COLOURS icon 4
  35. RENDER_DEVICE icon AMIGA
  36. RENDER_DITHER icon FLOYD
  37.  
  38. PROJECT_INFO icon TYPE
  39. if RESULT=='GREY' then
  40.     RENDER_QUANTIZE icon LOCK
  41. else
  42.     RENDER_QUANTIZE icon LOCK_BEST
  43. RENDER icon
  44. SAVE_CLIP icon
  45. CLOSE icon
  46.  
  47. exit
  48.  
  49. /*******************************************************************/
  50. /* This is where control goes when an error code is returned by IE */
  51. /* It puts up a message saying what happened and on which line     */
  52. /*******************************************************************/
  53. error:
  54. if RC=5 then do            /* Did the user just cancel us? */
  55.     IE_TO_FRONT
  56.     LAST_ERROR
  57.     'REQUEST "'||RESULT||'"'
  58.     exit
  59. end
  60. else do
  61.     IE_TO_FRONT
  62.     LAST_ERROR
  63.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  64.     exit
  65. end
  66.